﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Data.OracleClient;
using TracNghiem.Models;
namespace TracNghiem.Areas.Admin.Models
{
    public class ReportsModel
    {
        
        public string dichvu_id { get; set; }
        public string ten_dich_vu { get; set; }
        public string phanloai_id { get; set; }
        public string ten_phan_loai { get; set; }
        public string cau_hoi_id { get; set; }
        public string name { get; set; }
        public string cau_dung { get; set; }
        public string tong { get; set; }
        public List<ReportsModel> getReport_Question()
        {
            List<ReportsModel> bt = new List<ReportsModel>();
            string sql = "select * from bc_cau_hoi";            
            OracleDataReader odr = General.Lib_GetDataReader(sql);
            while (odr.Read())
            {
                bt.Add(new ReportsModel
                {
                    dichvu_id = odr["dichvu_id"].ToString(),
                    ten_dich_vu = odr["ten_dich_vu"].ToString(),
                    phanloai_id = odr["phanloai_id"].ToString(),
                    ten_phan_loai = odr["ten_phan_loai"].ToString(),
                    cau_hoi_id = odr["cau_hoi_id"].ToString(),
                    name = odr["name"].ToString(),
                    cau_dung = odr["cau_dung"].ToString(),
                    tong = odr["tong"].ToString(),
                    
                });
            }
            General.conn_global.Close();
            return bt;
            
        }
        public List<ReportsModel> FindReport_Question(string str)
        {
            List<ReportsModel> bt = new List<ReportsModel>();
            string sql = "select * from bc_cau_hoi"+str;
            OracleDataReader odr = General.Lib_GetDataReader(sql);
            while (odr.Read())
            {
                bt.Add(new ReportsModel
                {
                    dichvu_id = odr["dichvu_id"].ToString(),
                    ten_dich_vu = odr["ten_dich_vu"].ToString(),
                    phanloai_id = odr["phanloai_id"].ToString(),
                    ten_phan_loai = odr["ten_phan_loai"].ToString(),
                    cau_hoi_id = odr["cau_hoi_id"].ToString(),
                    name = odr["name"].ToString(),
                    cau_dung = odr["cau_dung"].ToString(),
                    tong = odr["tong"].ToString(),

                });
            }
            General.conn_global.Close();
            return bt;

        }
    }
       
}